import request from '@/utils/request'

export default {
    add:function (newsModule) {
        return request({
            url:'/hnister-security-service/rest/pt/role',
            method:'post',
            data:newsModule
        })
    },
    findById:function (id) {
        return request({
            url:'/hnister-security-service/rest/pt/role/'+id,
            method:'get'
        })
    },
    findAll:function () {
        return request({
            url:'/hnister-security-service/rest/pt/roles',
            method:'get'
        })
    },
    deleteById:function(id){

        return request({
            method:'delete',
            url:'/hnister-security-service/rest/pt/role/'+id,
        })
    },
    edit:function (module) {
        return request({
            method:'put',
            data:module,
            url:'/hnister-security-service/rest/pt/role',
        })
    },
    //为角色分配资源
    allocateResource:function (roleId,resourceIdList) {
        return request({
            url:'/hnister-security-service/rest/pt/roleAllocateResources/@/for=allocateResources',
            method:'post',
            data:{
                roleId,
                resourceIdList
            }
        })
    }
}
